package model;

import java.util.LinkedList;
import java.util.Queue;

public class MessageSpooler extends Subject {
	private static Queue<String> messages;
	private static MessageSpooler instance;
	
	private MessageSpooler() {
		messages = new LinkedList<String>();
	}
	
	public static MessageSpooler getInstance() {
		if (messages == null)
			instance = new MessageSpooler();
		return instance;
	}
	
	public void addMessage(String message) {
		messages.offer(message);
		notifyObservers();
	}
	
	public String getNextMessage() {
		return messages.poll();
	}
}
